﻿using Autofac;
using Autofac.Core;
using Autofac.Core.Registration;
using DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using Service = DependencyInjection.Service;

public class Program {
    public static IContainer Container = 
        ConfigServices();

    public static IContainer ConfigServices() {
        var builder = new ContainerBuilder();
        builder.RegisterModule(new ProgramModule());
        return builder.Build();
    }

    public static void Main() {
        var business = Program.Container.Resolve<Business>();
    }
}

public class ProgramModule : Module {
    protected override void Load(ContainerBuilder builder) {
        builder.RegisterType<Service>().As<IService>();
        builder.RegisterType<Business>();
    }
}